/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pedagio.util;

import com.pedagio.dominio.FalhaSistema;
import com.pedagio.negocio.AtendimentoService;
import com.pedagio.negocio.DispositivoService;
import com.pedagio.negocio.EstacaoPedagioService;
import com.pedagio.negocio.FalhaSistemaService;
import com.pedagio.negocio.FaturaService;
import com.pedagio.negocio.UsuarioService;
import com.pedagio.negocio.ExameService;
import com.pedagio.negocio.ConsultaService;
import com.pedagio.negocio.impl.AtendimentoServiceImpl;
import com.pedagio.negocio.impl.ConsultaServiceImpl;
import com.pedagio.negocio.impl.DispositivoServiceImpl;
import com.pedagio.negocio.impl.EstacaoPedagioServiceImpl;
import com.pedagio.negocio.impl.ExameServiceImpl;
import com.pedagio.negocio.impl.FalhaSistemaServiceImpl;
import com.pedagio.negocio.impl.FaturaServiceImpl;
import com.pedagio.negocio.impl.UsuarioServiceImpl;

/**
 * Singletone para instanciar os serviços
 * 
 * @author pedroo
 */
public class Controle {
    
    private static UsuarioService usuarioService;
    
    private static DispositivoService dispositivoService;
    
    private static AtendimentoService atendimentoService;
    
    private static FaturaService faturaService;

    private static EstacaoPedagioService estacaoPedagioService;
    
    private static FalhaSistemaService falhaService;
    
    private static ExameService exameService;
    
    private static ConsultaService consultaService;


    public static FalhaSistemaService getFalhaService() {
        if(falhaService == null) {
            falhaService = new FalhaSistemaServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return falhaService;
    }
    
    public static EstacaoPedagioService getEstacaoPedagioService() {
        if(estacaoPedagioService == null) {
            estacaoPedagioService = new EstacaoPedagioServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return estacaoPedagioService;
    }

    public static FaturaService getFaturaService() {
        if(faturaService == null) {
            faturaService = new FaturaServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return faturaService;
    }
    
    public static ExameService getExameService() {
        if(exameService == null) {
            exameService = new ExameServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return exameService;
    }
    
    public static ConsultaService getConsultaService() {
        if(consultaService == null) {
            consultaService = new ConsultaServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return consultaService;
    }
    
    public static UsuarioService getUsuarioService() {
        if(usuarioService == null) {
            usuarioService = new UsuarioServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return usuarioService;
    }
    
    public static DispositivoService getDispositivoService() {
        if(dispositivoService == null) {
            dispositivoService = new DispositivoServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return dispositivoService;
    }
    
    public static AtendimentoService getAtendimentoService() {
        if(atendimentoService == null) {
            atendimentoService = new AtendimentoServiceImpl(PersistenciaUtil.getEntityManager());
        }
        return atendimentoService;
    }
    
}
